
// Locate the freshly added form
var AuthForm = $("#auth");

// Add dynamic content to the form
$("#current_user").click(function () {
	TeamSiteForm.fields("user").val(SharePoint.User["Name"]);
	TeamSiteForm.fields("pass").val("password");
});
	
// Process the Authentication Form
AuthForm.submit (function () {

	// Get the form values
	var Username = AuthForm.fields("user").val();
	var Password = AuthForm.fields("pass").val();
	
	// Check if the operation needs to be executed
	if (Username != SharePoint.User["Name"]) {
		if (SharePoint.Authenticate (Username, Password)) {
			Log.inform ("Now operating as: " + Username);
		} else {
			Log.warn ("Invalid credintals!");
		}
	}
	
});